package com.example.demo.service.serviceImpl;

import com.example.demo.common.MessageBody;
import com.example.demo.common.RedisService;
import com.example.demo.entity.BfszInfo;
import com.example.demo.mapper.BfszMapper;
import com.example.demo.service.BfszService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created realshare
 * author:fh
 * Date:2019/4/22
 * Time:15:40
 * desc:备份规则设置实现类
 **/
@Service
public class BfszServiceImpl implements BfszService {
    private static Log logger = LogFactory.getLog(BfszServiceImpl.class);


    @Autowired
    private BfszMapper bfszMapper;

    @Autowired
    private RedisService redisService;

    /**
     * @auther: fh
     * @date 2019/4/22 15:45
     * @des 获取备份规则设置列表
     */
    @Override
    public MessageBody getBackupRuleList() {
        List<BfszInfo> backupRuleList = bfszMapper.getBackupRuleList();
        if (backupRuleList.size() == 0) {
            return MessageBody.getCostomMessageBody("暂无备份规则设置", true);
        }
        logger.info(redisService.getStr("qutongyua"));
        return MessageBody.getMessageBody(backupRuleList);
    }
}
